import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vite.dev/config/
export default defineConfig({
  plugins: [vue()],
  // 默认路径
  base: './',
  // 打包路径
  build: {
    outDir: 'dist'
  },
  // 配置@别名
  resolve: {
    alias: {
      '@': '/src'
    }
  },
  // 服务配置
  server: {
    host: '0.0.0.0',
    port: 8080,
    open: true,
    https: false,
    proxy: {
      '/api': {
        target: 'URL_ADDRESS',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, '')
      }
    }
  }
})
